import axios from 'axios';

export async function getAuthorityList(authorityName,authorityPath,pageNo=1,pageSize=10){
    let resp = await axios.get('api/pet_sys/authority.do',{
        params:{
            authorityName,
            authorityPath,
            pageNo,
            pageSize
        }
    })
    return resp;
}

export async function getAllAuthority(){
    let resp = await axios.get('api/pet_sys/authority.do',{
        params:{
            method:"getAllAuthority"
        }
    })
    return resp;
}

export async function deleteAuthority(authorityId){
    let resp = await axios.get('api/pet_sys/authority.do',{
        params:{
            method:'deleteAuthority',
            authorityId,
        }
    })
    return resp;
}

export async function addAuthority(ruleForm){
    let resp = await axios.get('api/pet_sys/authority.do',{
        params:{
            method:'addAuthority',
            authorityName:ruleForm.authorityName,
            authorityType:ruleForm.authorityType,
            authorityPath:ruleForm.authorityPath,
        }
    })
    return resp;
}

export async function updateAuthority(id,ruleForm){
    let resp = await axios.get('api/pet_sys/authority.do',{
        params:{
            method:'updateAuthority',
            authorityId:id,
            authorityName:ruleForm.authorityName,
            authorityType:ruleForm.authorityType,
            authorityPath:ruleForm.authorityPath,
        }
    })
    return resp;
}